In recent years, due to the increase in density of data recording media such as hard discs and optical discs, these data recording media have been used widely in recording digital images including moving pictures, AV data and the like. The application range is broad, and it extends not only to peripheral equipment of computer but also to home video recorders and players used for recording and reproducing respectively a television broadcast and the like. In the future, the use of hard discs and optical discs is expected to expand further as recording media for camcorders in place of tape media.
Conventionally, MPEG (Moving Picture Experts Group) 2 transport stream specified in IEC/ISO 13818 has been used as a data method for transmitting video and audio signals in a satellite digital broadcast, a terrestrial digital broadcast and the like in Japan, Europe and the United States. In MPEG 2, a transport stream is composed of a plurality of kinds of transport packets (fixed length: 188 bytes) that are time-division multiplexed.
As transport packets, there are a video packet having information corresponding to the video of a broadcast program, an audio packet having information corresponding to the audio of a broadcast program, and a PSI/SI packet having stream information and program information, for example.
A hard disc and an optical disc such as a DVD (Digital Versatile Disc) or a BD (Blu-ray disc) are data recording media that permit random access, and they are formatted generally in a 2 k-byte logical block unit called a sector on the basis of a file system such as FAT (File Allocation Table) or UDF (Universal Disk Format). Thus, in order to write and read AV data on/from these data recording media efficiently, it is necessary to record AV data contained in a transport stream on the data recording media in a sector unit (or an integral multiple unit of a sector).
JP 2001-167528 A discloses that, therefore conventionally, when it is assumed that a transport packet provided with a transport extra header (TP_extra_Header) of 4 bytes containing time information is a source packet (192 bytes) and a collection of 32 source packets is an aligned unit (Aligned unit), the aligned unit is used as a recording unit to a data recording medium. Further, it has been considered to use an aligned unit as a recording unit. The size of an aligned unit is the least common multiple between the size of a source packet and the sector size of a data recording medium. For instance, in the above example, the size of the aligned unit is 192 bytes×32=6 k bytes, which corresponds to 3 sectors when the data length of a single sector is 2 k bytes.
When recording AV data in a transport stream on a data recording medium such as a BD, the maximum size of a single file may be limited due to a file system such as FAT 32. Thus, when recording a large amount of AV data, it is necessary to record the AV data by dividing it into a plurality of files. In this regard, when recording a single continuous transport stream by dividing it into a plurality of files, an application that prohibits dividing at a midpoint of video GOP (Group of Pictures) data may be assumed. That is, a boundary between the plurality of files recorded on the BD and a boundary between GOPs have to coincide with each other. A GOP is a group of pictures to be an encoding unit.
The reasons for the specification are as follows. For example, when an instruction to reproduce AV data from a midpoint of a file is given, since an extremely long time is required to decode the file entirely from the beginning, it is preferable that decoding can be started from the head of arbitrary GOP including a reproduction starting position. Thus, in the BD specification, an offset of each GOP first packet from the head of a file is controlled.
Further, when an instruction for reverse reproduction (decode) is given, since it is necessary to pass GOPs in the file to a decoder and obtain them in an inverse order, the data size (the number of packets) of the range that includes each GOP data is needed. In the BD specification, a GOP size is obtained from the difference between an offset of the first packet of the GOP and the first packet of the subsequent GOP. The last GOP size of a file is the difference between an offset of the first packet of the GOP and an offset of the last packet of the file. Therefore, since it is desirable that a file is not divided at a midpoint of a GOP, a file division point and a GOP boundary coincide with each other as described above in the BD specification when a single transport stream is divided into a plurality of files and recorded.
When dividing and recording a file by using an aligned unit as a recording unit as in the prior art described in JP 2001-167528 A, the size of the divided file has to be an integer multiple of the size of an aligned unit. That is, in this case, a boundary between aligned units and a file division point (namely, a GOP boundary) have to coincide with each other. However, conventionally, a boundary between aligned units and a GOP boundary do not always coincide with each other because normally a transport stream generating apparatus is not aware of a GOP boundary and a file boundary during multiplexing. As a result, conventionally, in order to satisfy both the condition of using an aligned unit as a recording unit, and the condition of coinciding a boundary between aligned units and a file division point (namely, a GOP boundary), a transport stream generating apparatus has to obtain information on the size of the divided file from the file system of a recording apparatus, and count the size of a transport stream being generated through multiplexing.